package com.chengma.service.impl;

import java.util.Date;
import java.util.List;

import com.chengma.domain.TbUserCollectedQuestion;
import com.chengma.mapper.TbUserCollectedQuestionMapper;
import com.chengma.service.ITbUserCollectedQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 用户收藏问题记录Service业务层处理
 * 
 * @author tck
 * @date 2025-03-19
 */
@Service
public class TbUserCollectedQuestionServiceImpl implements ITbUserCollectedQuestionService
{
    @Autowired
    private TbUserCollectedQuestionMapper tbUserCollectedQuestionMapper;

    /**
     * 查询用户收藏问题记录
     * 
     * @param username 用户收藏问题记录主键
     * @return 用户收藏问题记录
     */
    @Override
    public TbUserCollectedQuestion selectTbUserCollectedQuestionByUsername(String username)
    {
        return tbUserCollectedQuestionMapper.selectTbUserCollectedQuestionByUsername(username);
    }

    /**
     * 查询用户收藏问题记录列表
     * 
     * @param tbUserCollectedQuestion 用户收藏问题记录
     * @return 用户收藏问题记录
     */
    @Override
    public List<TbUserCollectedQuestion> selectTbUserCollectedQuestionList(TbUserCollectedQuestion tbUserCollectedQuestion)
    {
        return tbUserCollectedQuestionMapper.selectTbUserCollectedQuestionList(tbUserCollectedQuestion);
    }

    /**
     * 新增用户收藏问题记录
     * 
     * @param tbUserCollectedQuestion 用户收藏问题记录
     * @return 结果
     */
    @Override
    public int insertTbUserCollectedQuestion(TbUserCollectedQuestion tbUserCollectedQuestion)
    {
        tbUserCollectedQuestion.setCreateTime(new Date());
        return tbUserCollectedQuestionMapper.insertTbUserCollectedQuestion(tbUserCollectedQuestion);
    }

    /**
     * 修改用户收藏问题记录
     * 
     * @param tbUserCollectedQuestion 用户收藏问题记录
     * @return 结果
     */
    @Override
    public int updateTbUserCollectedQuestion(TbUserCollectedQuestion tbUserCollectedQuestion)
    {
        return tbUserCollectedQuestionMapper.updateTbUserCollectedQuestion(tbUserCollectedQuestion);
    }

    /**
     * 批量删除用户收藏问题记录
     * 
     * @param usernames 需要删除的用户收藏问题记录主键
     * @return 结果
     */
    @Override
    public int deleteTbUserCollectedQuestionByUsernames(String[] usernames)
    {
        return tbUserCollectedQuestionMapper.deleteTbUserCollectedQuestionByUsernames(usernames);
    }

    /**
     * 删除用户收藏问题记录信息
     * 
     * @param username 用户收藏问题记录主键
     * @return 结果
     */
    @Override
    public int deleteTbUserCollectedQuestionByUsername(String username)
    {
        return tbUserCollectedQuestionMapper.deleteTbUserCollectedQuestionByUsername(username);
    }
}
